import { defineConfig } from "vitepress";
import { viteStaticCopy } from "vite-plugin-static-copy";

const base = "/blog/";
const cesiumSource = "node_modules/cesium/Build/Cesium";
const cesiumBaseUrl = "cesiumStatic";

// https://vitepress.dev/reference/site-config
export default defineConfig({
  base,
  lang: "zh",
  title: "李犇乐坏",
  description: "技术流浪汉",
  themeConfig: {
    // https://vitepress.dev/reference/default-theme-config
    nav: [
      { text: "浏览器", link: "/浏览器/事件循环/" },
      { text: "CSS", link: "/css/CSS属性计算过程/" },
      { text: "Cesium", link: "/Cesium/Introduction" },
      { text: "囤积癖", link: "/囤积癖/网站托管平台盘点" },
    ],
    sidebar: {
      "/浏览器/": [
        {
          text: "浏览器是如何工作的？",
          items: [
            { text: "事件循环", link: "/浏览器/事件循环/" },
            { text: "浏览器渲染原理", link: "/浏览器/浏览器渲染原理/" },
          ],
        },
      ],
      "/css/": [
        {
          text: "CSS",
          items: [
            { text: "CSS属性计算过程", link: "/css/CSS属性计算过程/" },
            { text: "CSS之包含块", link: "/css/CSS之包含块/" },
            { text: "Houdini", link: "/css/Houdini" },
          ],
        },
      ],
      "/Cesium/": [
        {
          text: "Cesium示例",
          items: [
            { text: "Cesium介绍", link: "/Cesium/Introduction" },
            { text: "创建地球", link: "/Cesium/CreatViewer" },
            { text: "视角缩放", link: "/Cesium/zoom" },
            { text: "计算两点距离", link: "/Cesium/distance" },
          ],
        },
      ],
      "/囤积癖/": [
        {
          text: "囤积癖",
          items: [
            { text: "网站托管平台盘点", link: "/囤积癖/网站托管平台盘点/" },
            { text: "气象可视化效果展示网站盘点", link: "/囤积癖/气象可视化效果展示网站盘点/" },
            { text: "盘点前端那些过时但优秀的库", link: "/囤积癖/盘点前端那些过时但优秀的库/" },
          ],
        },
      ],
    },
    socialLinks: [{ icon: "github", link: "https://github.com/GreenBoy0526" }],
    footer: {
      message: '鲁ICP备2024092964号-1'
    }
  },
  vite: {
    define: {
      CESIUM_BASE_URL: JSON.stringify(`${base}${cesiumBaseUrl}`),
    },
    plugins: [
      viteStaticCopy({
        targets: [
          { src: `${cesiumSource}/ThirdParty`, dest: cesiumBaseUrl },
          { src: `${cesiumSource}/Workers`, dest: cesiumBaseUrl },
          { src: `${cesiumSource}/Assets`, dest: cesiumBaseUrl },
          { src: `${cesiumSource}/Widgets`, dest: cesiumBaseUrl },
        ],
      }),
    ],
  },
});
